package com.sky.controller.user;

import com.sky.constant.StatusConstant;
import com.sky.dto.DishDTO;
import com.sky.pojo.Dish;
import com.sky.result.Result;
import com.sky.service.admin.DishService;
import com.sky.service.user.UDishService;
import com.sky.vo.DishVO;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user/dish")
@Api(tags = "查询分类")
public class UDishController {
    @Autowired
    private DishService dishService;

    @GetMapping("/list")
    public Result<List<DishVO>> getCategoryId(DishDTO dto){
        Dish dish = new Dish();
        dish.setCategoryId(dto.getCategoryId());
        dish.setStatus(StatusConstant.ENABLE);//查询起售中的菜品

        List<DishVO> dishList = dishService.listWithFlavor(dish);
        return Result.success(dishList);
    }
}
